package com.github.xuemingyu.springboot.acticitycloud.common;

import org.hibernate.SQLQuery;
import org.hibernate.Session;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.persistence.EntityManager;

@Service
public class SqlQuery {
    @Autowired
    EntityManager entityManager;

    public SQLQuery hqlQuery(String sql) {
        Session session = (Session) entityManager.getDelegate();
        SQLQuery sqlQuery = session.createSQLQuery(sql);
        return sqlQuery;
    }

}
